<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                template="/layout/main.xhtml">
    <ui:define name="title">Posts</ui:define>
    <ui:define name="content">

        <h2>Posts</h2>

        <h3>Post Comments</h3>

        <h:column rendered="#{postCommentBean.postId ne null}">
            <div class="post">
                <p>Post ID: #{postCommentBean.postId}</p>

                <p>#{postCommentBean.post.content}</p>
                <hr/>
                <h:column rendered="#{postCommentBean.post.comments.size() gt 0}">
                    <h4>Comments:</h4>
                    <h:dataTable value="#{postCommentBean.post.comments}" var="comment" styleClass="commentTable">
                        <h:column>
                            <div class="post" style="font-style: italic;">
                                #{comment.comment}
                            </div>
                        </h:column>
                    </h:dataTable>
                </h:column>
                <h:column rendered="#{postCommentBean.post.comments.size() eq 0}">
                    <br/>
                </h:column>
            </div>
        </h:column>
        <h:form>
            <h:commandLink action="post" value="Back to Post List" styleClass="commandLink"/>
        </h:form>
    </ui:define>
</ui:composition>
